<?php

namespace SinoPHP\BbdBoss\Api;

/**
 * 物理节点同步接口
 *
 * Params:
 *      data:startTime    (int)     查询起始时间
 *      data:endTime      (int)     查询结束时间
 */

class PhysicalNode extends ApiAbstract {

    public function v_1_0_0() {
        $params = $this->requestParams;

        //$this->checkToken(); // 校验TOKEN
        $where = [];
        if (isset($params['startTime']) && isset($params['endTime'])) {
            $where = ['update_time|<>' => [$params['startTime'], $params['endTime']]];
        }
        $fields = 'physical_node_id,physical_node_name,isp,large_area,node_level,province,min_limit,max_limit,is_delete';
        $data = model('PhysicalNode')->getList($fields, $where);
        foreach ($data as &$value){
            $value['min_limit'] = (int)$value['min_limit'];
            $value['max_limit'] = (int)$value['max_limit'];
            $value['is_delete'] = (int)$value['is_delete'];
        }
        $this->success($data);
    }

}